home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1987 August / Ahoy_Magazine_87-08_1987_Double_L_Side_A.d64 / Batter Up! (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  8KB  |  220 lines

  1. 5 rem    batter up! by jc hilty 3/87
  2. 6 printchr$(142)
  3. 10 gosub745
  4. 15 gosub515
  5. 20 b=0:k=0:ot=0:r=0:x=1
  6. 25 ifin=10then1050
  7. 30 poke2040,200:poke2042,202:fort=0to500:next
  8. 35 print"[144]"tab(2)b;tab(5)k;tab(9)ot;tab(14)in
  9. 40 ifot=3then420
  10. 45 ifk=3thenot=ot+1:gosub105:k=0:b=0:goto35
  11. 50 ifb=4thengosub380:b=0:k=0:gosub105:goto35
  12. 55 print""tab(22)"            "
  13. 60 print"[158]"tab(22)p$(x);" ";pa(x):gosub690:fort=0to1000:next
  14. 65 poke2042,203:fort=0to300:next:poke2042,204:fort=0to200:next
  15. 70 z=int(8*rnd(1)+1)
  16. 75 onzgosub120,130,120,140,120,150,120,160
  17. 80 w=206
  18. 85 fb=-((peek(56320)and16)=0)
  19. 90 iffb=1thenpoke2040,208:pokev+21,31:goto170
  20. 95 poke2044,w:fort=0to50:next:w=w+1:ifw=208then185
  21. 100 goto85
  22. 105 x=x+1:ifx=10thenx=1:return
  23. 110 return
  24. 115 rem    computer pitches
  25. 120 pokev+8,88:pokev+9,162:pokev+21,23:fort=0to50:next:pokev+9,172
  26. 125 return
  27. 130 pokev+8,88:pokev+9,162:pokev+21,23:fort=0to50:pokev+9,145
  28. 135 return
  29. 140 pokev+8,88:pokev+9,162:pokev+21,23:fort=0to50:pokev+9,172:pokev+8,120
  30. 145 return
  31. 150 pokev+8,88:pokev+9,162:pokev+21,23:fort=0to50:pokev+9,200:pokev+8,70
  32. 155 return
  33. 160 pokev+8,88:pokev+9,162:pokev+21,23:fort=0to50:pokev+9,200:pokev+8,100
  34. 165 return
  35. 170 fort=0to150:next:ifz=1orz=3orz=5orz=7then205
  36. 175 k=k+1:fort=0to200:next:pokev+21,7:e$="strike"
  37. 180 goto260
  38. 185 ifz=1orz=3orz=5orz=7thene$="strike":k=k+1:fort=0to500:next:goto195
  39. 190 e$="ball":b=b+1:fort=0to500:next
  40. 195 pokev+21,7:goto260
  41. 200 rem    batter hits ball
  42. 205 gosub705:pokev+21,7:e=rnd(5)+pa(x)/1000
  43. 210 ife>1.1thene$="home run":gosub285:b=0:k=0:gosub105:goto260
  44. 215 ife>.9thene$="triple":gosub310:b=0:k=0:gosub105:goto260
  45. 220 ife>.8thene$="double":gosub335:b=0:k=0:gosub105:goto260
  46. 225 ife>.6thene$="single":gosub380:b=0:k=0:gosub105:goto260
  47. 230 ife>.5thene$="foul ball":gosub245:goto260
  48. 235 ife>.3thene$="ground out":ot=ot+1:gosub105:b=0:k=0:goto260
  49. 240 e$="fly out":ot=ot+1:b=0:k=0:gosub105:goto260
  50. 245 ifk<2thenk=k+1:return
  51. 250 return
  52. 255 rem    display hitting results
  53. 260 print"[158]"tab(27)e$
  54. 265 fort=0to2500:next
  55. 270 print""tab(27)"          "
  56. 275 goto25
  57. 280 rem    homerun
  58. 285 ifr=0thenys=ys+1:r=0:gosub455:gosub510:return
  59. 290 ifr=1orr=2orr=4thenys=ys+2:r=0:gosub455:gosub510:return
  60. 295 ifr=3orr=5orr=6thenys=ys+3:r=0:gosub455:gosub510:return
  61. 300 ifr=7thenys=ys+4:r=0:e$="grand slam":gosub455:gosub510:return
  62. 305 rem    triple
  63. 310 ifr=0thenr=4:gosub455:return
  64. 315 ifr=1orr=2orr=4thenys=ys+1:r=4:gosub455:gosub510:return
  65. 320 ifr=3orr=5orr=6thenys=ys+2:r=4:gosub455:gosub510:return
  66. 325 ifr=7thenys=ys+3:r=4:gosub455:gosub510:return
  67. 330 rem    double
  68. 335 ifr=0thenr=2:gosub455:return
  69. 340 ifr=1thenr=6:gosub455:return
  70. 345 ifr=2thenys=ys+1:r=2:gosub455:gosub510:return
  71. 350 ifr=3thenys=ys+1:r=6:gosub455:return
  72. 355 ifr=4thenys=ys+1:r=2:gosub455:gosub510:return
  73. 360 ifr=5thenys=ys+1:r=6:gosub455:gosub510:return
  74. 365 ifr=6thenys=ys+2:r=2:gosub455:gosub510:return
  75. 370 ifr=7thenys=ys+2:r=6:gosub455:gosub510:return
  76. 375 rem    single or walk
  77. 380 ifr=0thenr=1:gosub455:return
  78. 385 ifr=1thenr=3:gosub455:return
  79. 390 ifr=3thenr=7:gosub455:return
  80. 395 ifr=4thenys=ys+1:r=1:gosub455:gosub510:return
  81. 400 ifr=5thenys=ys+1:r=3:gosub455:gosub510:return
  82. 405 ifr=6thenys=ys+1:r=5:gosub455:gosub510:return
  83. 410 ifr=7thenys=ys+1:r=7:gosub455:gosub510:return
  84. 415 ifr=2thenr=5:gosub455:return
  85. 420 i=int(4*rnd(6))
  86. 425 print"[158]"tab(22)"computer "i:gosub720
  87. 430 cs=cs+i:print""tab(22)"            "
  88. 435 print"[158]"tab(32)cs:gosub105
  89. 440 in=in+1:b=0:k=0:r=0:ot=0:gosub455
  90. 445 goto25
  91. 450 rem    place baserunners
  92. 455 r=r+1:onrgosub465,470,475,480,485,490,495,500
  93. 460 r=r-1:return
  94. 465 pokefi,160:pokesn,160:poketh,160:return
  95. 470 pokefi,86:pokesn,160:poketh,160:return
  96. 475 pokesn,86:pokefi,160:poketh,160:return
  97. 480 poketh,160:pokesn,86:pokefi,86:return
  98. 485 poketh,86:pokesn,160:pokefi,160:return
  99. 490 pokesn,160:poketh,86:pokefi,86:return
  100. 495 pokefi,160:pokesn,86:poketh,86:return
  101. 500 pokefi,86:pokesn,86:pokefi,86:return
  102. 505 rem    update score
  103. 510 print"[158]"tab(32)ys:return
  104. 515 rem    playing field
  105. 520 poke53281,8:poke53280,0
  106. 525 print"[147][144]   b  s  out  inn   [154]                   "
  107. 530 print"[144]                    [154]                   "
  108. 535 print"                    [154] [144]                [154]  "
  109. 540 fort=0to2:print"                    [154] [144] "tab(36)" [154]  ":next
  110. 545 print"[149]                    [154] [144] "tab(36)" [154]  "
  111. 550 fort=0to1:print"                    [154] [144] "tab(36)" [154]  ":next
  112. 555 print"                    [154] [144]                [154]  "
  113. 560 printtab(20)"[154]  [144] [154]            [144] [154]   "
  114. 565 print"                      [144]             [144]    "
  115. 570 print"                     [206]               [205] "
  116. 575 print"      [146][169]      [223]      [206]                 [205]"
  117. 580 print"                    [205]                 [206]"
  118. 585 print"[223]                  [146][169] [205]               [206] "
  119. 590 print" [223]                [146][169]   [205]             [206]  "
  120. 595 print"  [223]              [146][169]     [205]           [206]   "
  121. 600 print"   [175][175][175][175][175]    [175][175][175][175][175]       [205]   [206] [205]   [206]    "
  122. 605 print"  [206]    [206]    [205]    [205]       [205] [206]   [205] [206]     "
  123. 610 print" [206]    [206]     [146] [205]    [205]          [218]         "
  124. 615 print"[206]    [206]  [223]  [146][169]  [205]    [205]       [205]   [206]       "
  125. 620 print"    [206]"tab(15)"[205]            [205] [206]        "
  126. 625 print"[183][183][183][183]"tab(16)"[183][183][183][183]                   "
  127. 630 forx=2004to2022:pokex,160:pokex+54272,5:next
  128. 635 x=1063:fort=0to24:pokex,160:pokex+54272,0:x=x+40:next
  129. 640 print"[158]"tab(22)t$;tab(32)ys:print""tab(22)c$;tab(32)cs
  130. 645 print""tab(22)"now batting"
  131. 650 pokev+16,0:pokev+27,0:pokev+23,15:pokev+29,15:pokev+28,7
  132. 655 pokev+37,10:pokev+38,0
  133. 660 poke2040,200:pokev+39,7:pokev,30:pokev+1,150
  134. 665 poke2041,201:pokev+40,1:pokev+2,30:pokev+3,192
  135. 670 poke2042,202:pokev+41,6:pokev+4,78:pokev+5,120
  136. 675 poke2043,209:pokev+42,0:pokev+6,64:pokev+7,160
  137. 680 poke2044,205:pokev+43,1:pokev+8,80:pokev+9,192
  138. 685 pokev+21,7:return
  139. 690 fort=0to24:pokes+t,0:next
  140. 695 pokes,150:pokes+1,200:pokes+5,8:pokes+6,248:pokes+24,15:pokes+4,17
  141. 700 fort=0to0500:next:pokes+4,16:return
  142. 705 fort=0to24:pokes+t,0:next
  143. 710 pokes+24,15:pokes+1,80:pokes+5,80:pokes+6,245
  144. 715 pokes+4,129:fort=0to100:next:pokes+4,128:return
  145. 720 fort=0to24:pokes+t,0:next
  146. 725 pokes+18,128:pokes,75:pokes+6,240:pokes+14,12:pokes+15,250:pokes+24,207
  147. 730 forl=0to30:pokes+4,17:pokes+1,peek(s+27)
  148. 735 fort=0to100:next:next:pokes+4,0
  149. 740 return
  150. 745 poke53281,12:poke53280,0:print"[147]"tab(14)"************"
  151. 750 printtab(14)"*          *":printtab(14)"*batter up!*"
  152. 755 printtab(14)"*          *":printtab(14)"************":printtab(19)"by"
  153. 760 printtab(16)"jc hilty":print:print
  154. 765 print"please wait while we buy some peanuts.."
  155. 770 dimpa(9),p$(9):ys=0:cs=0:in=1:sn=1733:th=1850:fi=1856
  156. 775 s=54272:v=53248
  157. 780 forx=12800to13438:reada:pokex,a:next
  158. 785 forx=1to9:readp$(x):next
  159. 790 print"[147]please enter the name of your team...."
  160. 795 print"....up to 10 letters."
  161. 800 inputt$:iflen(t$)>10then790
  162. 805 iflen(t$)<1thent$="pittsburgh"
  163. 810 print"[147]please enter the computer team's name.."
  164. 815 print"..up to 10 letters."
  165. 820 inputc$:iflen(c$)>10then810
  166. 825 iflen(c$)<1thenc$="new york"
  167. 830 forx=1to9:pa(x)=int(300*rnd(5)+100):next
  168. 835 print"[147]lineups and batting averages":print:printt$:print
  169. 840 forx=1to9:printp$(x);" ";pa(x):next:print:print
  170. 845 print"press p to print lineup on printer...."
  171. 850 print"....any other key to continue."
  172. 855 geta$:ifa$=""then855
  173. 860 ifa$="p"thengosub1030
  174. 865 return
  175. 870 rem    sprite data
  176. 875 data 240,42,0,240,42,0,240,42,128,252,42,160,60,41,64,60,41,64,63,53,64
  177. 880 data 3,53,64,3,205,0,2,234,0,10,250,128,10,186,128,14,190,128,53,94,128
  178. 885 data 53,93,240,61,171,112,10,169,112,10,170,240,15,170,0,15,252,0,15,252,0
  179. 890 data 0
  180. 895 data 10,170,0,10,170,0,10,170,128,10,171,128,10,174,128,2,174,128
  181. 900 data 2,174,128,2,174,128,2,174,128,2,174,0,2,174,0,10,170,0,10,186,0
  182. 905 data 10,191,240,10,188,0,10,128,0,11,192,0,15,252,0,15,0,0,0,0,0,0,0,0,0
  183. 910 data 0,10,0,0,42,0,0,5,0,0,5,0,0,1,0,0,10,128,0,42,160,0,170,168,0,138,136
  184. 915 data 0,138,136,0,169,168,0,15,192,0,10,128,0,10,128,0,8,128,0,8,128
  185. 920 data 0,8,128,0,12,192,0,12,192,0,60,240,0,0,0,0
  186. 925 data 0,10,0,0,42,0,0,5,0,0,5,0,0,1,0,0,10,0,0,10,0,0,10,0,0,10,0,0,10,0
  187. 930 data 0,10,0,0,15,0,0,1,0,0,2,0,0,2,0,0,2,0,0,2,0,0,3,0,0,3,0,0,15,0
  188. 935 data 0,0,0,0
  189. 940 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,10,36,0,165,128,0,170,0
  190. 945 data 0,138,48,0,138,128,0,138,0,0,66,0,0,2,0,0,2,0,0,3,0,0,0,0,0,0,0
  191. 950 data 0,0,0,0,0,0,0
  192. 955 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,0,60,0,0,24,0
  193. 960 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  194. 965 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,0,60,0,0,126,0,0,60,0
  195. 970 data 0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  196. 975 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,0,0,255,0,0,255,0,0,255,0
  197. 980 data 0,255,0,0,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  198. 985 data 0,42,0,0,42,0,0,42,128,0,42,160,0,41,64,0,41,64,0,21,64,0,21,64
  199. 990 data 0,165,0,2,170,0,2,170,128,2,170,128,2,170,128,2,170,128,10,170,128
  200. 995 data 10,170,128,10,170,128,10,170,0,15,234,0,15,252,0,15,252,0,0
  201. 1000 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,124,135,255,252
  202. 1005 data 255,255,252,128,63,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  203. 1010 data 0,0,0,0,0,0,0
  204. 1015 rem    player names
  205. 1020 data rocky,spike,pete,willie,hammer,jim,moose,boomer,hawk
  206. 1025 rem    printout lineup
  207. 1030 print"[147]make sure printer is on....":print"....press any key."
  208. 1035 geta$:ifa$=""then1035
  209. 1040 open3,4,0:print#3,"lineup and averages for ";t$
  210. 1045 forx=1to9:print#3,p$(x);" ";pa(x):next:close3
  211. 1046 print:print"press any key to begin game."
  212. 1047 geta$:ifa$=""then1047
  213. 1048 return
  214. 1049 rem    game over
  215. 1050 pokev+21,0
  216. 1055 poke53281,0:poke53280,0:print"[147][154]"tab(14)"************"
  217. 1060 printtab(14)"*scoreboard*":printtab(14)"************":print:print
  218. 1065 printtab(14)t$;ys:printtab(14)c$;cs
  219. 1070 end
  220.